<link rel="stylesheet" href="../addons/jy_merch/css/mobile.css?v=2">
<div   ng-if="pagedata.op!='fa'" class='fui-page fui-page-current'>
    <div class="fui-header fui-header-success">
        <div class="fui-header-left">
            <a class="back" ng-click="goback();"></a>
        </div>
        <div class="title">订单管理</div>
    </div>
    <!-- 顶部tab -->
    <div id="tab" class="fui-tab fui-tab-success fixed">
			<a ng-class="{'active':pagedata.key==1}" ng-click="access_json('/manage.order_list/status1/')">待发货</a>
            <a ng-class="{'active':pagedata.key==1}" ng-click="access_json('/manage.order_list/status0/')" >待付款</a>
            <a ng-class="{'active':pagedata.key==2}" ng-click="access_json('/manage.order_list/status2/')">待收货</a>
            <a ng-class="{'active':pagedata.key==3}" ng-click="access_json('/manage.order_list/status3/')">已完成</a>
            <a ng-class="{'active':pagedata.key==4}" ng-click="access_json('/manage.order_list/status4/')">已关闭</a>
    </div>
    <div class='fui-content navbar'>
		<div class="searchbar" style='margin:0.3rem;padding:0'>
                    <div class="search-input">
                        <i id="searchsub" class="icon icon-search" ng-click="pagedata.getlist('all')"></i>
                        <input type="search" id='keywords' ng-model="pagedata.params.keyword" placeholder="输入订单号..." style="border: 1px solid #f7f7f7;">
                    </div>
        </div>
        <!-- 订单列表 -->
        <div class="fui-list-outer container"></div>
		
        <div ng-repeat="item in pagedata.list" class="fui-list-group" >

            <a class="fui-list order-list title-b" ng-click="access_json('/manage.order_detail//id='+item.id)"  data-nocache="true">
                <div class="fui-list-media">
                    <span ng-if='item.ispay==1' class="fui-label fui-label-danger round">{{pagedata.paytype[item.paytype]}}</span>
					<span ng-if='item.ispay==0' class="fui-label fui-label-danger round">未付款</span>
                </div>
                <div class="fui-list-inner">
                    <div class="row">
                        <div class="row-text" style="font-size: 0.7rem; color: #666">{{item.ordersn}}</div>
                    </div>
                    <div class="row gary">
                        <div class="row-text">{{item.createtime}}</div>
                    </div>
                </div>
                <div class="angle"></div>
            </a>
            
                <div ng-repeat="g in item.goods" class="fui-list goods-list">
                    <div class="fui-list-media">
                        <img class="round" ng-src="{{tomedia(g.image)}}"  />
                    </div>
                    <div class="fui-list-inner">
                        <div class="title">{{g.title}}</div>
                        
                    </div>
                    <div class="fui-list-angle auto">￥<span class="marketprice">{{g.realprice}}<br> x{{g.total}}</span></div>
                </div>
           
            <div class="fui-list log-list noclick">
                <div class="fui-list-inner">
                    <div class="row log-row order">
                        <div class="row-text">订单状态</div>
                        <div class="row-remark"><span class="text-danger">{{pagedata.status[item.status]}}</span></div>
                    </div>
                   
                   
                    <div class="row log-row order">
                        <div class="row-text">买家昵称</div>
                        <div class="row-remark">{{item.nickname}}</div>
                    </div>
                    <div class="row log-row order">
                        <div class="row-text">配送方式</div>
                        <div class="row-remark"><span class="text-success">{{item.sendtype}}</span></div>
                    </div>
                   
                        <div ng-if="item.remark" class="row log-row order">
                            <div class="row-text">买家留言</div>
                            <div class="row-remark">{{item.remark}}</div>
                        </div>
                  
                </div>
            </div>

            <div class="fui-list-group-title text-right">
                <small class="status">共<span class="text-success">{{item.goodscount}}</span>个商品 实付:<span class="text-success">￥{{item.price}}</span> </small>
            </div>
            <div class="fui-list-group-title text-right big">
                <!-- 未付款 -->
                <a ng-if="item.ispay==0" ng-click="post({},'ispay','id='+item.id)"  class="btn btn-sm btn-success order-btn" data-action="payorder" >立即付款</a>
                <!-- 已付款 -->
				<a ng-if="item.status==1" ng-click="access_json('/manage.order_list/fa/id='+item.id)" class="btn btn-success btn-sm order-btn" data-action="send" >确认发货</a> 
                <a ng-if="item.status==2" ng-click="post({},'shou','id='+item.id)" class="btn btn-success btn-sm order-btn" data-action="sendcancel">确认收货</a>
                <a class="btn btn-default btn-sm" ng-click="access_json('/manage.order_detail//id='+item.id)">查看详情</a>
            </div>
        </div>
        <div ng-if="pagedata.list==''" class="fui-title center" id="content-empty">没有数据</div>
    </div>
    <div class="head-menu-mask"></div>
</div>
<div ng-if="pagedata.op=='fa'" class='fui-page fui-page-current'>
    <div class="fui-header fui-header-success">
        <div class="fui-header-left">        
        </div>
        <div class="title">发货</div>
        <div class="fui-header-right"></div>
    </div>
    <div class='fui-content navbar'>
        <div class="fui-cell-group">
            <div class="fui-cell ">
                <div class="fui-cell-label ">快递公司</div>
                <div class="fui-cell-info">
                    <select class="weui_select" name="select2" ng-model="pagedata.item.express">
                        <option ng-repeat="f in pagedata.express" value="{{f.id}}">{{f.name}}</option>
                    </select>
                <div class="fui-cell-remark"></div>
                </div>
            </div>
            <div class="fui-cell">
                <div class="fui-cell-label">快递单号</div>
                <div class="fui-cell-info">
                    <input type="text" placeholder="请输入快递单号" class="fui-input" ng-model="pagedata.item.expresssn"   id="subtitle" />
                </div>
            </div>
        </div>
	</div>
	<div >
        <div  ng-click="post(pagedata.item,'/manage.order_list/fa/')" class="nav-item btn btn-success btn-submit">确定</div>
   </div>
</div>
<div ng-include="sys_html('common/pluginnav',true)"></div>
<script type="text/javascript">
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});

scope.loading = true;
var page = 1;
var keyword = '';
var op = '';
op = scope.pagedata.op;
scope.pagedata.getlist=function(e,){
	if(e==1){
		page = 1;
		scope.pagedata.list=[]
	}
	if(scope.pagedata.params.keyword!=null){
		 keyword =scope.pagedata.params.keyword;
	}else{
		keyword ='';
	}
		var params = {
					'plugin':'jy_merch',
					'action':'manage.order_list',
					'op':op,
					'data':{
						'page':page,
						'keyword':keyword,
					},
					'callback':function(data){
							if(data.error !=1){
							 for (var i=0;i<data.list.length;i++){
									scope.pagedata.list.push(data.list[i]);
								}
								if(page >1){
									$("#store-item").animate({scrollTop:0},300);
								}
								page++;
								scope.loading = false;
								window.scope.pagedata.list=data.list;
								scope.$apply();
							}else{
								onsole.log('error');
							};
					}
		}
		scope.post_json(params);
}
scope.pagedata.getlist(1);
   
</script>
